// index.js
// 获取应用实例
const app = getApp()

Page({
  data: {
    value:0,
    sty1:0,
    sty2:0,
    sty3:0,
    sty4:0
  },
 
  onLoad(options) {
    var that = this;
    var nickname = wx.getStorageSync('nicheng')
    that.setData({
      nickname:nickname
    })
    console.log(nickname)
    console.log(options);
    that.setData({
      area: options.area,
      agent: options.agent,
      page: options.page,
    })
    if (options.p_open_id) {
      console.log('分享')
      that.setData({
        p_open_id: options.p_open_id
      })
    } else {
      console.log('no分享')
    }
  },

  next() {
    console.log(this.data.value)
    if(this.data.value!=0){
      wx.setStorageSync('value', this.data.value)
      wx.navigateTo({
        url: '../leixingtwo/leixingtwo'
      })
    }
   
  },
  chooseA(){
    var that=this;
    that.setData({
      value:1,
      sty2:0,
      sty3:0,
      sty4:0,
      sty1:1
    })
    console.log(that.data.value)
    console.log(that.data.value)
  },
  chooseB(){
    var that=this;
    that.setData({
      value:2,
      sty1:0,
      sty3:0,
      sty4:0,
      sty2:1
    })
    console.log(that.data.value)
  },
  chooseC(){
    var that=this;
    that.setData({
      value:3,
      sty1:0,
      sty2:0,
      sty4:0,
      sty3:1
    })
    console.log(that.data.value)
  },
  chooseD(){
    var that=this;
    that.setData({
      value:4,
      sty1:0,
      sty2:0,
      sty3:0,
      sty4:1
    })
    console.log(that.data.value)
  },
  getUserProfile(e) {
    // 推荐使用wx.getUserProfile获取用户信息，开发者每次通过该接口获取用户个人信息均需用户确认，开发者妥善保管用户快速填写的头像昵称，避免重复弹窗
    wx.getUserProfile({
      desc: '展示用户信息', // 声明获取用户个人信息后的用途，后续会展示在弹窗中，请谨慎填写
      success: (res) => {
        console.log(res)
        this.setData({
          userInfo: res.userInfo,
          hasUserInfo: true
        })
      }
    })
  },
  getUserInfo(e) {
    // 不推荐使用getUserInfo获取用户信息，预计自2021年4月13日起，getUserInfo将不再弹出弹窗，并直接返回匿名的用户个人信息
    console.log(e)
    this.setData({
      userInfo: e.detail.userInfo,
      hasUserInfo: true
    })
  }
})